package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class NewForDemo {
    public static void main(String[] args) {
        String[] array={"one","two","three","fore","five"};
        /*for (int i=0;i<array.length;i++){
            System.out.println(array[i]);
        }*/

        for (String str:array){
            System.out.println(str);
        }


        Collection c=new ArrayList();
        c.add("one");
        c.add("two");
        c.add("three");
        c.add("fore");
        c.add("five");
        Iterator it =c.iterator();
        /*while (it.hasNext()){
            String str=(String)it.next();
            System.out.println(str);
        }*/
        for (Object ojb:c){
            String str=(String)ojb;
            System.out.println(str);
        }
    }
}
